<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="vtc" uri="/vtc-core-tags"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<html>
<head>
	<title>Archive Image</title>
	<script type="text/javascript">
		function clickBtn(action) {
			switch (action) {
			case "search":
				$("#mainForm_search").attr("value", "true");
				break;
			case "clear":
				$("#mainForm_search").attr("value", "false");
				break;
			}
	
			$("#mainForm").submit();
		}
		function turnToAchiveImagePage(planningId){
			window.location="archive!input.action?planning.id="+planningId;
		}
	</script>
</head>
<body>

<div class="content">
	<div class="pageTitle">Archived Image</div>
	
	<s:actionmessage/>
	
	<div class="form1">
		<s:form id="mainForm" name="mainForm" method="post" action="archive.action">
			<s:hidden name="search"></s:hidden>
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td class="sep"><img src="../images/spacer.gif"
						style="width: 180px;" /></td>
					<td class="sep sep2"><img src="../images/spacer.gif" /></td>
				</tr>
				<tr>
					<td><label class="fLabel">Planning Exercise</label>
						<div class="fField">
							<s:select id="planningExercise" name="planning.category.planYear"
								list="categoryService.planYearList"
								listKey="key" listValue="value" headerKey="" headerValue="-All-"
								cssStyle="width: 180px"></s:select>
						</div></td>
					<td><label class="fLabel">Level of Planning</label>
						<div class="fField">

							<s:select id="planningLevel" name="planning.planningLevel"
								list="#{'SecondLevel':'2nd Level','ThirdLevel':'3rd Level'}"
								listKey="key" listValue="value" headerKey="" headerValue="-All-"
								cssStyle="width: 180px"></s:select>

						</div></td>
				</tr>
			</table>

			<div class="btnSet btnSetTypeB">
				<div class="left">
					<div class="button">
						<div class="left">
							<div class="right">
								<input class="inputButton" type="button" id="" name=""
									value="Search" onclick="clickBtn('search')" />
							</div>
						</div>
					</div>
					<div class="button">
						<div class="left">
							<div class="right">
								<input class="inputButton" type="button" id="" name=""
									value="Clear" onclick="clickBtn('clear')" />
							</div>
						</div>
					</div>
				</div>
			</div>
	</div>
	<s:if test="%{page!=null&&page.result!=null&&page.result.size()!=0}">
		<div class="sListBorder">
			<div class="sList">
				<table width="100%" class="sTable" cellpadding="0" cellspacing="0"
					border="0">
					<tr>
						<td class="sTh t">Planning Exercise</td>
						<td class="sTh t">Level of Planning</td>
						<td class="sTh t">Status</td>
						<td class="sTh t">Action</td>
					</tr>

					<s:iterator value="page.result" var="planning" status="st">

						<s:set var="trClass" value="'sRow1'"></s:set>
						<s:if test="#st.index%2==0">
							<s:set var="trClass" value="'sRow2'"></s:set>
							<s:else>
								<s:set var="trClass" value="'sRow1'"></s:set>
							</s:else>
						</s:if>
						<tr class="<s:property value='#trClass'/>">
							<td class="sCell"><s:property
									value="#planning.category.planYear" /></td>
							<td class="sCell"><s:property
									value="#planning.planningLevel" /></td>
							<td class="sCell"><s:property value="#planning.status" /></td>
							<td class="sCell buttonCell"><div class="button sbtn">
									<div class="left">
										<div class="right">
											<input class="inputButton" type="button" id="" name=""
												value="Archive"
												onclick="turnToAchiveImagePage('<s:property value='#planning.id'/>')" />
										</div>
									</div>
								</div>
							</td>
					</s:iterator>
				</table>
			</div>
			  <vtc:paging page="%{page}"></vtc:paging>
		</div>
	</s:if>

	</s:form>
</div>

</body>
</html>